package IU;

import java.util.Observable;
import java.util.Observer;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;

import GEF.Aplicacao;
import IU_Accoes.IU_Orcamento;
import IU_Accoes.IU_aguardaAccao;
import Logica.Orcamento;
import Logica.aguardaAccao;

import java.awt.BorderLayout;

import javax.swing.border.BevelBorder;

import java.awt.SystemColor;

import javax.swing.border.EtchedBorder;
import javax.swing.border.SoftBevelBorder;

import java.awt.Color;

import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;

import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;

import javax.swing.BoxLayout;
import javax.swing.border.MatteBorder;
import javax.swing.border.CompoundBorder;
import javax.swing.JButton;

import java.awt.GridLayout;
import java.awt.Component;
import java.awt.FlowLayout;

@SuppressWarnings("serial")
public class mnCentro extends JPanel implements Observer{

	/**
	 * Create the panel.
	 */
	
	private Aplicacao app;
	private JPanel panel;
	JPanel panel_1;
	IU_aguardaAccao accao;
	
	public mnCentro(Aplicacao _app) {
		this.app = _app;
		

		 panel = new JPanel();
		app.addObserver(this);
        setLayout(new BorderLayout(0, 0));
        panel.setLayout(new BorderLayout(0, 0));
        
        panel_1 = new JPanel();
        panel_1.setLayout(new BorderLayout(0, 0));
        panel_1.setBorder(new CompoundBorder(new LineBorder(new Color(105, 105, 105), 1, true), new BevelBorder(BevelBorder.RAISED, null, null, new Color(160, 160, 160), null)));
        panel.add(panel_1 , BorderLayout.CENTER);
        
        JPanel panel_2 = new JPanel();
        panel.add(panel_2, BorderLayout.NORTH);
        
        JPanel panel_3 = new JPanel();
        panel.add(panel_3, BorderLayout.WEST);
        
        JPanel panel_4 = new JPanel();
        panel.add(panel_4, BorderLayout.EAST);
        
        JPanel panel_5 = new JPanel();
        panel.add(panel_5, BorderLayout.SOUTH);
        this.add(panel);
        
		inicializaComponents();

	}
	private void inicializaComponents() {
		accao = new IU_aguardaAccao();
	}

	@Override
	public void update(Observable o, Object arg) {
		// TODO Auto-generated method stub
		if (app.getEstadoActual() instanceof aguardaAccao){
			panel_1.removeAll();
			panel_1.add(accao);
		}
		else if (app.getEstadoActual() instanceof Orcamento){
//			orcamento.setVisible(true);
//			orcamento.setEnabled(true);
		}
	}
}
